<?php
namespace Amis\dataviewer;

use Amis\Basics\AmisBasics;

class Steps extends AmisBasics
{
    const StepStatusWait = 'wait';
    const StepStatusProcess = 'process';
    const StepStatusFinish = 'finish';
    const StepStatusError = 'error';
    public string $type = 'steps';

    /**
     * 数组，配置步骤信息
     * @param \Amis\dataviewer\Step ...$steps
     * @return $this
     */
    public function steps(Step ...$steps)
    {
        $this->set(__FUNCTION__,...$steps);
        return $this;
    }

    /**
     * 选项组源，可通过数据映射获取当前数据域变量、或者配置 API 对象
     * @param $source
     * @return $this
     */
    public function source($source)
    {
        $this->source = $source;
        return $this;
    }

    /**
     * 关联上下文变量
     * @param string $name
     * @return $this
     */
    public function name(string $name)
    {
        $this->name = $name;
        return $this;
    }

    /**
     * 设置默认值，注意不支持表达式
     * 设置当前默认第几步
     * @param string $value
     * @return $this
     */
    public function value(string $value)
    {
        $this->value = $value;
        return $this;
    }

    public function status(self $status)
    {
        $this->status = $status;
        return $this;
    }

    public function className(string $className)
    {
        $this->className = $className;
        return $this;
    }

    /**
     * 指定步骤条方向。目前支持水平（horizontal）和竖直（vertical）两种方向
     * @param bool $IsVertical
     * @return $this
     */
    public function mode(bool $IsVertical = false)
    {
        $this->mode = $IsVertical ? 'vertical' : 'horizontal';
        return $this;
    }

    /**
     * 指定标签放置位置，默认水平放图标右侧，可选 (vertical) 放图标下方
     * @param bool $IsVertical
     * @return $this
     */
    public function labelPlacement(bool $IsVertical = false)
    {
        $this->labelPlacement = $IsVertical ? 'vertical' : 'horizontal';
        return $this;
    }

    /**
     * 点状步骤条
     * @param bool $progressDot
     * @return $this
     */
    public function progressDot(bool $progressDot = false)
    {
        $this->progressDot = $progressDot;
        return $this;
    }
}